﻿//-----------------------------------------------------------------------
// <copyright file="MLdoWork.cs" company="MAPILab Ltd">
//     Copyright (c) MAPILab Ltd.  All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace MAPILab.SharePoint.Explorer.ObjectBrowser.AsyncWork
{
    using System.Windows.Forms;

    #region Enums

    /// <summary>
    /// Status of work
    /// </summary>
    public enum WorkState
    {
        /// <summary>
        /// begin, create root
        /// </summary>
        start,

        /// <summary>
        /// expand note
        /// </summary>
        expand,

        /// <summary>
        /// When threads are aborted
        /// </summary>
        aborted,

        /// <summary>
        /// report results of expand
        /// </summary>
        end
    }

    #endregion

    public class MLDoWork
    {     
        #region Fields

        /// <summary>
        /// Status of work
        /// </summary>
        private WorkState workState;

        /// <summary>
        /// Tree node
        /// </summary>
        private TreeNode node;

        /// <summary>
        /// Tree node parents
        /// </summary>
        private TreeNodeCollection parentNodes;

        /// <summary>
        /// Number of backgroundWorker
        /// </summary>
        private int backgroundWorkerNumber;

        #endregion

        #region Properties

        /// <summary>
        /// Gets and sets status of work
        /// </summary>
        public WorkState WorkState
        {
            get { return workState; }
            set { workState = value; }
        }

        /// <summary>
        /// Gets and sets tree node
        /// </summary>
        public TreeNode Node
        {
            get { return node; }
            set { node = value; }
        }

        /// <summary>
        /// Gets and sets tree node parents
        /// </summary>
        public TreeNodeCollection ParentNodes
        {
            get { return parentNodes; }
            set { parentNodes = value; }
        }

        /// <summary>
        /// Gets and sets number of backgroundWorker
        /// </summary>
        public int BackgroundWorkerNumber
        {
            get { return backgroundWorkerNumber; }
            set { backgroundWorkerNumber = value; }
        }

        #endregion

        #region Constructor

        /// <summary>
        /// Default Constructor
        /// </summary>
        public MLDoWork()
        {
            backgroundWorkerNumber = 0;
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="work">Status of work</param>
        /// <param name="node">Tree node</param>
        /// <param name="parentNodes">Tree node parents</param>
        /// <param name="backgroundWorkerNumber">Number of backgroundWorker</param>
        public MLDoWork(WorkState work, TreeNode node, TreeNodeCollection parentNodes, int backgroundWorkerNumber)
            : this()
        {
            this.workState = work;
            this.node = node;
            this.parentNodes = parentNodes;
            this.backgroundWorkerNumber = backgroundWorkerNumber;
        }

        #endregion
    }
}
